#!/bin/bash
#

read -p "用户名: " name


id $name &> /dev/null
if [ $? -eq 0 ]; then
   echo "用户${name}存在"
else
   read -p "密 码: " password
   useradd $name
   echo "$password" | passwd --stdin $name &> /dev/null
   echo "用户${name}创建完成"
fi
